package com.ala4.oxcafe.entity;

import com.ala4.oxcafe.core.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 菜单信息
 *
 * @author PING
 * @version 1.0.0
 * @date 2025/8/12 12:39
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("menu_info")
@Schema(description = "菜单信息")
public class MenuInfo extends BaseEntity {

    @Schema(description = "主键id")
    @TableId(value = "id", type = IdType.INPUT)
    @NotNull(message = "ID不能为空", groups = {Update.class})
    private Long id;

    @Schema(description = "菜单名称")
    @NotNull(message = "菜单名称不能为空", groups = {Create.class, Update.class})
    @NotEmpty(message = "菜单名称不能为空", groups = {Create.class, Update.class})
    private String menuName;

    @Schema(description = "父菜单ID")
    @NotNull(message = "父菜单ID不能为空", groups = {Create.class, Update.class})
    private Long parentId;

    @Schema(description = "显示顺序")
    private Integer menuSort;

    @Schema(description = "路由地址")
    private String path;

    @Schema(description = "组件地址")
    private String component;

    @Schema(description = "是否为外链（0是 1否）")
    private Integer isFrame;

    @Schema(description = "是否缓存（0缓存 1不缓存）")
    private Integer isCache;

    @Schema(description = "是否显示（0显示 1隐藏）")
    private Integer visible;

    @Schema(description = "菜单类型（M目录 C菜单 F按钮）")
    @NotNull(message = "菜单类型不能为空", groups = {Create.class, Update.class})
    @NotEmpty(message = "菜单类型不能为空", groups = {Create.class, Update.class})
    private String menuType;

    @Schema(description = "权限标识")
    private String perms;

    @Schema(description = "菜单图标")
    private String icon = "#";

    @Schema(description = "菜单状态（0正常 1停用）")
    @NotNull(message = "菜单状态不能为空", groups = {Create.class, Update.class})
    private Integer status;

    public interface Create {
    }

    public interface Update {
    }
}
